# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=golang-github-linuxdeepin-go-x11-client
pkgver=0.6.9
pkgrel=2
pkgdesc='X11 protocol go language binding'
arch=('any')
url="https://github.com/linuxdeepin/go-x11-client"
license=('GPL')
depends=('go' 'golang-deepin-lib' 'golang-golang-x-text')
checkdepends=('xorg-server-xvfb' 'golang-github-stretchr-testify' 'golang-gopkg-check.v1' 'git')
source=("$pkgname-$pkgver.tar.gz::https://github.com/linuxdeepin/go-x11-client/archive/$pkgver.tar.gz")
sha512sums=('df89b5824f86fa3bb853c6e698ef2a02b8164139e257d09c5f18104a38084aba50f39202fdaf1759b3a66b1eca6491facabb7de011fb412618c887e3cf4544c4')

export GO111MODULE=off

check() {
  export GOPATH="$srcdir/build:/usr/share/gocode"
  mkdir -p "$srcdir"/build/src/github.com/linuxdeepin
  cp -a "$srcdir"/go-x11-client-$pkgver "$srcdir"/build/src/github.com/linuxdeepin/go-x11-client
  cd "$srcdir"/build/src/github.com/linuxdeepin/go-x11-client
  xvfb-run go test -v $(go list ./...)
}

package() {
  mkdir -p "$pkgdir"/usr/share/gocode/src/github.com/linuxdeepin
  cp -a "$srcdir"/go-x11-client-$pkgver "$pkgdir"/usr/share/gocode/src/github.com/linuxdeepin/go-x11-client

  rm -r "$pkgdir"/usr/share/gocode/src/github.com/linuxdeepin/go-x11-client/debian
}
